<template>
  <div>
    <p>money: {{money}}</p>

    <button @click="updateMoney">update money</button>
  </div>
</template>

<script>
export default {
  props: {
    money: {
      type: Number,
      default: 10
    }
  },
  emits: ['updateMoney'],
  setup (props, ctx) {
    // ctx.emit => Vue2 this.$emit
    // ctx.attrs => Vue2 this.$attrs，非 props 属性组成的对象
    // ctx.slots => Vue2 this.$slots，插槽信息组成的对象
    console.log(ctx)
    const updateMoney = () => {
      ctx.emit('updateMoney', 10)
    }
    return {updateMoney}
  }
}
</script>

<style lang="scss" scoped>

</style>